<template>
    <div>
        <h1>{{ route.params.id}}</h1>
    </div>
</template>

<script setup>
import { onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';

const route = useRoute();
const article = ref({ id: null });

onMounted(() => {
    // 增加错误处理机制
    article.value.id = route.params.id;
    console.log(article.value.id);
});
</script>


<style lang="scss" scoped>

</style>